//
//  Helper.swift
//  Pods
//
//  Created by green on 15/11/7.
//
//

import UIKit

public class Helper: NSObject {

    
}

/**
 颜色转图片
 
 - parameter color: 颜色
 
 - returns: 图片
 */
public func imageWithColor(color: UIColor) -> UIImage {
    
    let rect = CGRectMake(0, 0, 1, 1)
    UIGraphicsBeginImageContext(rect.size)
    let context = UIGraphicsGetCurrentContext()
    CGContextSetFillColorWithColor(context, color.CGColor)
    CGContextFillRect(context, rect)
    
    let image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    
    return image
}

/**
 字符串数组转字符串
 
 - parameter stringArray: 字符串数组
 
 - returns: 字符串
 */
public func covertToString(stringArray:[String]) -> String {
    
    var resultStr = ""
    for tuple in stringArray.enumerate() {
        
        if tuple.index == stringArray.count-1 {
            
            resultStr += tuple.element
        } else {
            
            resultStr += ","+tuple.element
        }
    }
    return resultStr
}